package com.yx.server.query;

import com.yx.server.base.BaseQuery;
import org.apache.commons.lang3.StringUtils;

public class UserQueryLink extends BaseQuery {

    private String userName;
    private String mobile;
    private Integer userSf;
    private Integer status;
    private Integer grade;
    private Long positionId;
    private String specialty;

    @Override
    protected void init() {
        if (null != status) {
            params.put("status", status);
        }
        if (null != userSf) {
            params.put("userSf", userSf);
        }
        if (StringUtils.isNotBlank(userName)) {
            params.put("userName:"+LINK.LIKE, "%" + StringUtils.trim(userName) + "%");
        }
        if (StringUtils.isNotBlank(mobile)) {
            params.put("mobile:"+LINK.LIKE, "%" + StringUtils.trim(mobile) + "%");
        }
        if (null != grade) {
            params.put("grade", grade);
        }
        if (null != positionId) {
            params.put("positionId", positionId);
        }
        if (StringUtils.isNotBlank(specialty)) {
            params.put("specialty:"+LINK.LIKE, "%" + StringUtils.trim(specialty) + "%");
        }
    }

    @Override
    public String sortOrder() {
        return "created DESC";
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public Integer getUserSf() {
        return userSf;
    }

    public void setUserSf(Integer userSf) {
        this.userSf = userSf;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getGrade() {
        return grade;
    }

    public void setGrade(Integer grade) {
        this.grade = grade;
    }

    public Long getPositionId() {
        return positionId;
    }

    public void setPositionId(Long positionId) {
        this.positionId = positionId;
    }

    public String getSpecialty() {
        return specialty;
    }

    public void setSpecialty(String specialty) {
        this.specialty = specialty;
    }
}
